<?php

/* * 
 * 资讯
 */
namespace Common\Model;
use Think\Model;
class CustomerModel extends BaseModel {

    public function queryForList($page=null, $map=null, $order=null) {
        $list = $this->alias("cus")
            ->join("left join __CATEGORY__ c on c.category_id = cus.category_id")
            ->where(getWhereSqlByMap($map))
//            ->order("cus.customer_id asc")
            ->order($order)
            ->limit($page->firstRow . ',' . $page->listRows)
            ->field("cus.*,c.category_name")
            ->select();

        return $list;

    }

    public function getListCount($map = null) {

        $count = $this->alias("cus")
            ->where(getWhereSqlByMap($map))
            ->count();

        return $count;
    }
}

